﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using hospital_registration_system.BLL;
using hospital_registration_system.Entity;

namespace hospital_registration_system.Utility
{
    /// <summary>
    /// 所有科室管理功能的类
    /// </summary>
    public class ManagerDepartments
    {
        protected static DepartmentsService service = new DepartmentsService();
        /// <summary>
        /// 查询所有的科室
        /// </summary>
        /// <returns>返回科室的信息链表</returns>
        public static List<Departments> getAllDepartments()
        {
            
            return service.selectAllDepartments();
        }

        /// <summary>
        /// 删除指定id的科室GridView1_RowDeleting
        /// </summary>
        /// <param name="id"></param>
        /// <returns>返回操作提示信息</returns>
        public static string deleteDepartment(int id)
        {
            if (service.deleteDepartmentsById(id))
            {
                return "删除成功";
            }
            else
            {
                return "删除失败";
            }
        }

        /// <summary>
        /// 修改科室表
        /// </summary>
        /// <param name="departments"></param>
        /// <returns></returns>
        public static string updateDepartment(Departments departments)
        {
            if (service.updateDepartments(departments))
            {
                return "修改成功";
            }
            else
            {
                return "修改失败";
            }
        }

        public static string insertDepartment(string departmentName)
        {
            if (service.insertDepartments(departmentName))
            {
                return "插入成功";
            }
            else
            {
                return "插入失败";
            }
        }
    }
}
